from typing import Sequence
import pandas as pd
import numpy as np
from forecast_models import *
from accuracy import RMSE,MAE,MAPE,R_square
df = pd.read_csv('data.csv',index_col = 0)
df = df.interpolate(method='linear')
# df = df.iloc[0:3000,:]
import warnings
import time
times = time.strftime('%Y-%m-%d-%H-%M',time.localtime(time.time()))
warnings.filterwarnings('ignore')
horizon = 1
sequence_length=6
model_index2 = 'ssa-lstm'
y_test_rel,y_ssa_pre = SSA(df,sequence_length = sequence_length,horizon = horizon)
mae_ssa = MAE(y_test_rel,y_ssa_pre)
rmse_ssa = RMSE(y_test_rel,y_ssa_pre)
mape_ssa = MAPE(y_test_rel,y_ssa_pre)
ssa_R2=R_square(y_test_rel,y_ssa_pre)
print('ssa的MAE为：'+str(mae_ssa)) #"MAE:"
print('ssa的RMSE为：'+str(rmse_ssa)) #"RMSE:"
print('ssa的MAPE为：'+str(mape_ssa))
print('ssa的R2为：'+str(ssa_R2))
print('******************')
print(y_ssa_pre)
x=pd.DataFrame(y_ssa_pre,columns=['SSA-LSTM'])
x.to_csv('SSA-LSTM-pre.csv')